<?php
// +--------------------------------------------------------------------------
// | ZAIYOUDAO [ 载攸道 先顺得常 ] <http://www.zaiyoudao.com>
// +--------------------------------------------------------------------------
// | Copyright © 2009-2016 载攸道 版权所有 <TEL:17090888854>
// +--------------------------------------------------------------------------
// | Project: YiPHP [ 我会的仅仅是偷懒！ ] <http://www.yiphp.com>
// +--------------------------------------------------------------------------
// | Author: 牛很多戒很多不戒 <n@isdce.com> <http://juexue.wang>
// +--------------------------------------------------------------------------

/**
 * CMS
 */
namespace Mall\Controller;
use Common\Controller\AdminController;
use Think\Upload;
/**
 * 菜单
 */
class ClassifyController extends AdminController{
	
	/**
	 *  专辑管理
	 */
    public function All_album(){
		
		$m_mall_content = M('mall_content');
		$m_common_user = M('common_user');
		
		//用户UID
		$uid = I('param.uid')?I('param.uid'):'';

		if($uid!=0){
			
			$map['uid'] =array('like',"%$uid%");
		}
		$this->assign('uid',$uid);
		//判断是否搜索用户名
		$name = I('param.name');
		if($name){
			$map['name'] = array('like',"%$name%");
		}
		$this->assign('name',$name);
		
		//判断是否搜索状态
		$status = I('param.status');
		if($status){
			$map['status'] = $status;
			$this->assign('status',$status);
		}else{
			$map['status'] = array('in','1,2,3,4');
		}
		//开始结束时间
		$begin_time = strtotime(I('param.begin_time'));
		$end_time = strtotime(I('param.end_time'));
		if($begin_time != null and $end_time != null){
			$map['time']  = array(array('egt',$begin_time),array('elt',$end_time),'and');
		}else{
			//默认今天明天
			$begin_time=time();
			$end_time=time()+86400;
		}
		$this->assign('begin_time',$begin_time);
		$this->assign('end_time',$end_time);
		
		$map['type'] = get_mall_model_conf('MALL_ALBUM');
		$list = $m_mall_content->where($map)->order('time desc')->page($_GET['p'].',50')->select();
		#dump($map);die;
		$count      = $m_mall_content->where($map)->count();// 查询满足要求的总记录数
		$Page       = new \Think\Page($count,50);// 实例化分页类 传入总记录数和每页显示的记录数
		$show       = $Page->show();// 分页显示输出 
		$this->assign('pages',$show);
		//查询关联信息
		foreach($list as $i=>$k){
			$umap['id'] = $list[$i]['uid'];
			$udata = $m_common_user->where($umap)->find();
			$list[$i]['channel'] = $fdata['name'];
			$list[$i]['nickname'] = $udata['nickname'];
			$list[$i]['n_img'] = $udata['img'];
		}
		//dump($list);die;
		//赋值
		$this->assign('list',$list);
		
		$status_list = getstatus();
		$this->assign('status_list',$status_list);
		$this->display();
	}
	
	/**
	 *  专辑管理
	 */
    public function tui_album(){
		
		$m_mall_content = M('mall_content');
		$m_common_user = M('common_user');
		
		
		//用户UID
		$uid = I('param.uid')?I('param.uid'):'';

		if($uid!=0){
			
			$map['uid'] =array('like',"%$uid%");
		}
		$this->assign('uid',$uid);
		//判断是否搜索用户名
		$name = I('param.name');
		if($name){
			$map['name'] = array('like',"%$name%");
		}
		$this->assign('name',$name);
		
		//开始结束时间
		$begin_time = strtotime(I('param.begin_time'));
		$end_time = strtotime(I('param.end_time'));
		if($begin_time != null and $end_time != null){
			$map['time']  = array(array('egt',$begin_time),array('elt',$end_time),'and');
		}else{
			//默认今天明天
			$begin_time=time();
			$end_time=time()+86400;
		}
		$this->assign('begin_time',$begin_time);
		$this->assign('end_time',$end_time);
		
		
		$map['type'] = get_mall_model_conf('MALL_ALBUM');
		$map['status'] = 1;
		$map['recommended'] = 1;
		$list = $m_mall_content->where($map)->order('time desc')->page($_GET['p'].',50')->select();
		#dump($map);die;
		$count      = $m_mall_content->where($map)->count();// 查询满足要求的总记录数
		$Page       = new \Think\Page($count,50);// 实例化分页类 传入总记录数和每页显示的记录数
		$show       = $Page->show();// 分页显示输出 
		$this->assign('pages',$show);
		//查询关联信息
		foreach($list as $i=>$k){
			$umap['id'] = $list[$i]['uid'];
			$udata = $m_common_user->where($umap)->find();
			$list[$i]['channel'] = $fdata['name'];
			$list[$i]['nickname'] = $udata['nickname'];
			$list[$i]['n_img'] = $udata['img'];
		}
		//dump($list);die;
		//赋值
		$this->assign('list',$list);
		$this->display();
	}
	/**
	 *  专辑管理
	 */
    public function no_album(){
		
		$m_mall_content = M('mall_content');
		$m_common_user = M('common_user');
		
		
		//用户UID
		$uid = I('param.uid')?I('param.uid'):'';

		if($uid!=0){
			
			$map['uid'] =array('like',"%$uid%");
		}
		$this->assign('uid',$uid);
		//判断是否搜索用户名
		$name = I('param.name');
		if($name){
			$map['name'] = array('like',"%$name%");
		}
		$this->assign('name',$name);
		
		//开始结束时间
		$begin_time = strtotime(I('param.begin_time'));
		$end_time = strtotime(I('param.end_time'));
		if($begin_time != null and $end_time != null){
			$map['time']  = array(array('egt',$begin_time),array('elt',$end_time),'and');
		}else{
			//默认今天明天
			$begin_time=time();
			$end_time=time()+86400;
		}
		$this->assign('begin_time',$begin_time);
		$this->assign('end_time',$end_time);
		
		
		$map['type'] = get_mall_model_conf('MALL_ALBUM');
		$map['status'] = 3;
		$list = $m_mall_content->where($map)->order('time desc')->page($_GET['p'].',50')->select();
		#dump($map);die;
		$count      = $m_mall_content->where($map)->count();// 查询满足要求的总记录数
		$Page       = new \Think\Page($count,50);// 实例化分页类 传入总记录数和每页显示的记录数
		$show       = $Page->show();// 分页显示输出 
		$this->assign('pages',$show);
		//查询关联信息
		foreach($list as $i=>$k){
			$umap['id'] = $list[$i]['uid'];
			$udata = $m_common_user->where($umap)->find();
			$list[$i]['channel'] = $fdata['name'];
			$list[$i]['nickname'] = $udata['nickname'];
			$list[$i]['n_img'] = $udata['img'];
		}
		//dump($list);die;
		//赋值
		$this->assign('list',$list);
		$this->display();
	}
	
	/* 新增专辑 */
	 public function create_album(){
		 
		include_once 'upload.func.php';
		$m_mall_content = M("mall_content");
		 
		 if(IS_POST){
			
			$data['langue'] = I("param.langue");         //语言
			$data['type'] = implode(',',I("param.type"));             //流派风格
			$data['name'] = I("param.name");             //专辑名称
			$data['lyrics'] = I("param.lyrics");          //作词
			$data['compose'] = I("param.compose");        //作曲
			$data['arranged'] = I("param.arranged");      //编曲
			$data['record'] = I("param.record");           //录音
			$data['mixing'] = I("param.mixing");           //混音
			$data['singer'] = I("param.singer");           //演唱者
			$data['producer'] = I("param.producer");       //制作人
			$data['producers'] = I("param.producers");       //出品方
			$data['money'] = I("param.money");       //出售单价
			$data['inventory'] = I("param.inventory");       //发行量
			$data['release_time'] = strtotime(I("param.release_time"));       //发行时间
			$data['img'] = I("param.img");       //封面图
			$data['bottom_img'] = I("param.bottom_img");       //封底图
			$data['color_img'] = I("param.color_img");       //宣传彩页图
			//$data['foil_img'] = I("param.foil_img");       //歌词本底衬页图
			$data['intro'] = I("param.intro");       //专辑介绍
			$data['time'] = time();
			$data['type'] = get_mall_model_conf('MALL_ALBUM');
			$data['ip'] = get_client_ip();
			$data['status'] = 2;
			$data['value'] = I('param.value')?I('param.value'):'';
			$data['uid'] = getUID();
			
			//$result = $m_mall_content->add($data);
			#添加歌曲
			if(!$result){
				#歌曲文件 music_song
				$music_song = $_FILES['music_song'];
				dump($music_song);die;
				foreach($music_song as $i=>$v){
					foreach($music_song[$i] as $ii=>$vv){
						$music_song_list[$ii][$i] = $music_song[$i][$ii];
					}
				}
				
				#歌曲名称 music_name  
				
				$music_name = I("param.music_name");
				
				#歌词 music_lyrics
				$music_lyrics = $_FILES['music_lyrics'];
				foreach($music_lyrics as $i=>$v){
					foreach($music_lyrics[$i] as $ii=>$vv){
						$music_lyrics_list[$ii][$i] = $music_lyrics[$i][$ii];
					}
				}
				#歌词本底衬页图  foil_img
				$foil_img = $_FILES['foil_img'];
				
				foreach($foil_img as $i=>$v){
					foreach($foil_img[$i] as $ii=>$vv){
						$foil_img_list[$ii][$i] = $foil_img[$i][$ii];
					}
				}
				
				foreach($music_song_list as $fileInfo) {  
					$res = uploadFile($fileInfo); 
					if(isset($res['dest'])) {  
						$uploadFiles[] = $res['dest'];
					}  
				}
				$uploadFiles=array_filter($uploadFiles);
				
				foreach($uploadFiles as $i=>$v){
					$img_name_list = explode("/",$uploadFiles[$i]);
					$count = count($img_name_list);
					$str_str = substr($uploadFiles[$i],1);
					$gequ_array[] = $str_str;
					#源文件与现文件记录
					upload_file_name($img_name_list[$count - 1],$music_song_list[$i]['name'],$uploadFiles[$i],$music_song_list[$i]['size']);
				}
				$uploadFiles = array();
				
				#歌词上传
				foreach($music_lyrics_list as $fileInfo) {  
					$res = uploadFile($fileInfo);
					
					if(isset($res['dest'])) {  
						$uploadFiles[] = $res['dest'];  
					}  
				}
				$uploadFiles=array_filter($uploadFiles);
				foreach($uploadFiles as $i=>$v){
					$img_name_list = explode("/",$uploadFiles[$i]);
					$count = count($img_name_list);
					$str_str = substr($uploadFiles[$i],1);
					$geci_array[] = $str_str;
					#源文件与现文件记录
					upload_file_name($img_name_list[$count - 1],$music_lyrics_list[$i]['name'],$uploadFiles[$i],$music_lyrics_list[$i]['size']);
				}
				
				#歌词本底衬页图  foil_img
				$uploadFiles = array();
				foreach($foil_img_list as $fileInfo) {  
					$res = uploadFile($fileInfo);
					if(isset($res['dest'])) {  
						$uploadFiles[] = $res['dest'];  
					}  
				}
				$uploadFiles=array_filter($uploadFiles);
				foreach($uploadFiles as $i=>$v){
					$img_name_list = explode("/",$uploadFiles[$i]);
					$count = count($img_name_list);
					$str_str = substr($uploadFiles[$i],1);
					$gecichenye_array[] = $str_str;
					#源文件与现文件记录
					upload_file_name($img_name_list[$count - 1],$foil_img_list[$i]['name'],$uploadFiles[$i],$foil_img_list[$i]['size']);
				}
				#获取对应歌曲个数
				$music_img_count = I('param.music_img_count');
				
				#添加该专辑下的歌曲
				$cc_count = 0;
				
				foreach($gequ_array as $gi=>$gv){
					$song_map['mp3'] = $gequ_array[$gi];
					$song_map['name'] = $music_name[$gi];
					if($geci_array[$gi]){
						$song_map['value'] = $geci_array[$gi];
					}
					$song_map['form_id'] = $result;
					$song_map['uid'] = getUID();
					$song_map['type'] = get_mall_model_conf('MALL_SONG');  //表示专辑下的歌曲
					$song_map['ip'] = get_client_ip();
					$song_map['status'] = 1;
					$geci_result = $m_mall_content->add($song_map);
				
					for ($x=0; $x<$music_img_count[$gi]; $x++) {
						mall_img(2,$geci_result,trim($uploadFiles[$cc_count],'.'));
						$cc_count ++;
					}
						
				}
			}
			
			
			if($result){    //设置成功后跳转页面的地址，默认的返回页面是$_SERVER['HTTP_REFERER'] 
				$this->success('新增成功', U('Mall/Classify/Album'));
			} else {    //错误页面的默认跳转页面是返回前一页，通常不需要设置  
				$this->error('新增失败');
			}
		 }else{
			 #查询语言
			$langeue_list = getlangeues();
			#查询流派风格
			$type_list = gettypes();
			
			$this->assign("langeue_list",$langeue_list);
			$this->assign("type_list",$type_list);
			$this->assign("time",time());
			$this->display();			
		 }
		 
		
	 }
	
	/* 编辑专辑 */
	 public function Edit_album(){
		$m_mall_content = M('mall_content');
		
		$map['id'] = I('param.id');
		//判断是否是ajax请求
		if(IS_POST){
			
			$data['langue'] = I("param.langue");         //语言
			$data['style'] = I("param.style");             //流派风格
			$data['name'] = I("param.name");             //专辑名称
			$data['lyrics'] = I("param.lyrics");          //作词
			$data['compose'] = I("param.compose");        //作曲
			$data['arranged'] = I("param.arranged");      //编曲
			$data['record'] = I("param.record");           //录音
			$data['mixing'] = I("param.mixing");           //混音
			$data['singer'] = I("param.singer");           //演唱者
			$data['producer'] = I("param.producer");       //制作人
			$data['producers'] = I("param.producers");       //出品方
			$data['money'] = I("param.money");       //出售单价
			$data['inventory'] = I("param.inventory");       //发行量
			$data['release_time'] = strtotime(I("param.release_time"));       //发行时间
			$data['img'] = I("param.img");       //封面图
			$data['bottom_img'] = I("param.bottom_img");       //封底图
			//$data['color_img'] = I("param.color_img");       //宣传彩页图
			//$data['foil_img'] = I("param.foil_img");       //歌词本底衬页图
			$data['intro'] = I("param.intro");       //专辑介绍
			
			$data['ip'] = get_client_ip();
			
			$result = $m_mall_content->where($map)->save($data);
			
			if($result){    //设置成功后跳转页面的地址，默认的返回页面是$_SERVER['HTTP_REFERER'] 
			
				$this->success('编辑成功', U('Mall/Classify/Album'));
			
			} else {    //错误页面的默认跳转页面是返回前一页，通常不需要设置  
			
				$this->error('编辑失败');
			
			}
		
		}else{
			
			$map['type'] = get_mall_model_conf('MALL_ALBUM');
			$map['status'] = array('in','2,4');
			$map['uid'] = getUID();
			$data = $m_mall_content->where($map)->find();
			
			#查询专辑下歌曲
			$f_map['form_id'] = $data['id'];
			$f_map['type'] = 17;    //专辑下歌曲
			$f_map['status'] = 1;  
			$f_list = $m_mall_content->where($f_map)->select();
			#查询歌曲下的歌词本底图
			
			
			 #查询语言
			$langeue_list = getlangeues();
			#查询流派风格
			$type_list = gettypes();
			
			$this->assign("langeue_list",$langeue_list);
			$this->assign("type_list",$type_list);
			$this->assign('data',$data);
			$this->display();
		}
		 
	 }
	
	/* 管理员编辑专辑 */
	 public function Edit_all_album(){
		$m_mall_content = M('mall_content');
		
		$map['id'] = I('param.id');
		//判断是否是ajax请求
		if(IS_POST){
			
			$data['langue'] = I("param.langue");         //语言
			$data['style'] = I("param.style");             //流派风格
			$data['name'] = I("param.name");             //专辑名称
			$data['lyrics'] = I("param.lyrics");          //作词
			$data['compose'] = I("param.compose");        //作曲
			$data['arranged'] = I("param.arranged");      //编曲
			$data['record'] = I("param.record");           //录音
			$data['mixing'] = I("param.mixing");           //混音
			$data['singer'] = I("param.singer");           //演唱者
			$data['producer'] = I("param.producer");       //制作人
			$data['producers'] = I("param.producers");       //出品方
			$data['money'] = I("param.money");       //出售单价
			$data['inventory'] = I("param.inventory");       //发行量
			$data['release_time'] = strtotime(I("param.release_time"));       //发行时间
			$data['img'] = I("param.img");       //封面图
			$data['bottom_img'] = I("param.bottom_img");       //封底图
			$data['color_img'] = I("param.color_img");       //宣传彩页图
			$data['foil_img'] = I("param.foil_img");       //歌词本底衬页图
			$data['intro'] = I("param.intro");       //专辑介绍
			
			$data['ip'] = get_client_ip();
			
			$result = $m_mall_content->where($map)->save($data);
			
			if($result){    //设置成功后跳转页面的地址，默认的返回页面是$_SERVER['HTTP_REFERER'] 
			
				$this->success('编辑成功', U('Mall/Classify/All_Album'));
			
			} else {    //错误页面的默认跳转页面是返回前一页，通常不需要设置  
			
				$this->error('编辑失败');
			
			}
		
		}else{
			
			$map['type'] = get_mall_model_conf('MALL_ALBUM');
			$map['status'] = array('in','1,3,2,4');
			$data = $m_mall_content->where($map)->find();
			 #查询语言
			$langeue_list = getlangeues();
			#查询流派风格
			$type_list = gettypes();
			
			$this->assign("langeue_list",$langeue_list);
			$this->assign("type_list",$type_list);
			$this->assign('data',$data);
			$this->display();
		}
		 
	 }
	
	
	
	/**
	 *  专辑管理
	 */
    public function  Album(){
		
		$m_mall_content = M('mall_content');
		$m_common_user = M('common_user');
		
		
		//判断是否搜索用户名
		$name = I('param.name');
		if($name){
			$map['name'] = array('like',"%$name%");
		}
		$this->assign('name',$name);
		
		//判断是否搜索状态
		$status = I('param.status');
		if($status){
			$map['status'] = $status;
			$this->assign('status',$status);
		}else{
			$map['status'] = array('in','1,2,3,4');
		}
		
		
		//开始结束时间
		$begin_time = strtotime(I('param.begin_time'));
		$end_time = strtotime(I('param.end_time'));
		if($begin_time != null and $end_time != null){
			$map['time']  = array(array('egt',$begin_time),array('elt',$end_time),'and');
		}else{
			//默认今天明天
			$begin_time=time();
			$end_time=time()+86400;
		}
		$this->assign('begin_time',$begin_time);
		$this->assign('end_time',$end_time);
		
		
		$map['type'] = get_mall_model_conf('MALL_ALBUM');
		$map['uid'] = getUID();
		$list = $m_mall_content->where($map)->order('time desc')->page($_GET['p'].',50')->select();
		#dump($map);die;
		$count      = $m_mall_content->where($map)->count();// 查询满足要求的总记录数
		$Page       = new \Think\Page($count,50);// 实例化分页类 传入总记录数和每页显示的记录数
		$show       = $Page->show();// 分页显示输出 
		$this->assign('pages',$show);
		
		$status_list = getstatus();
		
		//dump($status_list);die;
		//赋值
		$this->assign('list',$list);
		$this->assign('status_list',$status_list);
		$this->display();
	}
	
	/**
	 * 菜单管理
	 */
    public function Manage(){
		common_public()->assign_page('分类管理');
		
		$m_mall_content = M('mall_content');
		
		//获得上级信息
		$fmap['id'] = I('param.form_id')?I('param.form_id'):0;
		$fmap['type'] = get_mall_model_conf('MALL_CLASSIFY');
		$fmap['status'] = 1;
		
		$data = $m_mall_content->where($fmap)->find();
		
		//获得菜单信息
		$map['form_id'] = $fmap['id'];
		$map['type'] = $fmap['type'];
		$map['status'] = 1;
		
		$list = $m_mall_content->where($map)->order('sort desc')->select();
		
		//赋值
		$this->assign('list',$list);
		$this->assign('data',$data);
		$this->assign('form_id',$fmap['id']);
		
		
		$this->display();
	}
	
	/**
	 * 新增菜单
	 */
	public function Create(){
		

		//判断是否是ajax请求
		if(IS_AJAX){

			$m_mall_content = M('mall_content');
		
			
			//获得数据
			$data = I();
			
			$data['value'] = I('param.value','','');
			$data['uid'] = getUID();
			$data['form_id'] =  I('param.form_id','','');
			$data['type'] = get_mall_model_conf('MALL_ALBUM');;
			$data['time'] = time();
			$data['ip'] = get_client_ip();
			$data['status'] = 1;
			
			$result = $m_mall_content->add($data);
			
			//返回信息
			$info = $result?get_errcode(0):get_errcode(-1);
			
			
				
		}
		
		//返回信息		
		$info = $info?$info:get_errcode(-2);

		$this->ajaxReturn($info);
	}
	
	/**
	 * 编辑菜单
	 */
	public function Edit(){
    
	
		//判断是否是ajax请求
		if(IS_AJAX){

			$m_mall_content = M('mall_content');
			$map['id'] = I('param.id');
			set_mall_draft($map['id']); //保存草稿
			
			$data = I('');
			unset($data['id']);
		
			$result = $m_mall_content->where($map)->save($data);
			
			//返回信息
			$info = $result?get_errcode(0):get_errcode(-1);
		
		}
		
		//返回信息		
		$info = $info?$info:get_errcode(-2);

		$this->ajaxReturn($info);
	}
	
	/**
	 * 批量删除菜单
	 */
	public function Delete($id,$status=0){
		
	
		//判断是否是ajax请求
		if(IS_AJAX){
				
			$m_mall_content = M('mall_content');
		
			$id = $id?$id:I('param.id');
			$status = $status?$status:I('param.status');
			
			if($id){
				
			
				$id = explode(',',$id); 
				
				
				foreach($id as $i=>$k){
					
					
					$map['id'] = $id[$i];
					$data['status'] = $status;
					
					$m_mall_content->where($map)->save($data);
					
				}
				
				//返回信息
				$info = get_errcode(0);
			
			}else{
				
				$info = get_errcode(10000001);
			}
			
	
		
		}
		
		//返回信息		
		$info = $info?$info:get_errcode(-2);

		$this->ajaxReturn($info);


	}
	
	/* 推荐专辑 */
	public function best_album(){
		
		$this->display();
	}
	
	/* 多图使用选择页面 */
    public function zip_log(){
	
		header("Content-type:text/html;charset=utf-8");	
		$m_mall_content_img = M("mall_content_img");    //多图选择表
		$m_common_upload = M("common_upload");    //上传记录表
		
		$type = I('param.type');
		$form_id = I('param.form_id');
		
		/* type为1封面  2歌词本地图 */
		$map['form_id'] = $form_id;
		$map['type'] = $type;
		$result = $m_mall_content_img->where($map)->select();
		if($result){
			foreach($result as $i=>$v){
				$url_name = explode("/",$result[$i]['url']);
				$url_count = count($url_name);
				$name = $url_name[$url_count-1];
				$img_map['title'] = array("like","%$name%");
				
				$img_name_array = $m_common_upload->where($img_map)->find();
				if($img_name_array){
					$list[$i]['original_name'] = $img_name_array['original'];
					$list[$i]['size'] = getFilesize($img_name_array['size']);
					$list[$i]['time'] = date("Y-m-d H:i",$img_name_array['time']);
					$list[$i]['url'] = $img_name_array['url'];
					$list[$i]['id'] = $result[$i]['id'];
					$list[$i]['employ'] = $result[$i]['employ'];
				}else{
					$list[$i]['original_name'] = $list[$i]['img_name'];
					$list[$i]['size'] = "不详";
					$list[$i]['time'] = "不详";
				}
			}
		}
		
		$this->assign("list",$list);
		$this->assign("form_id",$form_id);
		$this->assign("type",$type);
		$this->display();
	}
	
	/* 删除多图封面 */
	public function delete_file(){
		if(IS_AJAX){
			$m_mall_content_img = M("mall_content_img");    //多图选择表
			$id = I('param.id');
			if($id>0){
				$map['id'] = $id;
				$result = $m_mall_content_img->where($map)->delete();
			}
			
			if($result){
				$info = 1;
			}else{
				$info = 2;
			}
		}else{
			$info = 3;
		}
		$this->ajaxReturn($info);
		
	}
	
	/* 添加多图 */
	public function zip(){
		include_once 'upload.func.php';
		$m_mall_content_img = M("mall_content_img");    //多图选择表
		$form_id = I('param.form_id');
		$type = I('param.type');
		
		$files = getFiles(); 
		foreach($files as $fileInfo) {  
			$res = uploadFile($fileInfo);  
			if(isset($res['dest'])) {  
				$uploadFiles[] = $res['dest'];  
			}  
		} 
		$str = '';
		$uploadFiles=array_filter($uploadFiles);
		
		foreach($uploadFiles as $i=>$v){
			$img_name_list = explode("/",$uploadFiles[$i]);
			$count = count($img_name_list);
			$url = trim($uploadFiles[$i],'.');
			
			mall_img($type,$form_id,$url);
			upload_file_name($img_name_list[$count - 1],$files[$i]['name'],$uploadFiles[$i],$files[$i]['size']);
		}
		if($uploadFiles){
			$this->success("添加成功",U("Mall/Classify/zip_log/form_id/$form_id/type/$type"));
		}
	}
	
	
	/* 专辑评论 */
	public function employ(){
		$m_mall_content_img = M("mall_content_img");    //多图选择表
		
		$form_id = I("param.form_id");
		$type = I("param.type");
		$id = I("param.id");
		
		$map['form_id'] = $form_id;
		$map['type'] = $type;
		$data['employ'] = 0;
		$m_mall_content_img->where($map)->save($data);
		$save_map['id'] = $id;
		$save_data['employ'] = 1;
		$m_mall_content_img->where($save_map)->save($save_data);
		
		$this->ajaxReturn(1);
	}
	
	
	/* 专辑评论 */
	public function album_comments(){
		
		$this->display();
	}
	
	/* 活动评论 */
	public function Activity_comments(){
		
		$this->display();
	}
	
	/* 单曲评论 */
	public function Song_comments(){
		
		$this->display();
	}
	
	
	
}